{include file="public/adminhead"}
<div class="container-fluid p-t-15">

	<div class="row">
		<div class="col-md-6">
			<div class="card">
				<div class="card-header"><h4>添加视频</h4></div>
				<div class="card-body">

					<form class="form-horizontal" action="#" onsubmit="return false" method="post" enctype="multipart/form-data" >
						{if $res}
						<input type="hidden" name="id" value="{$res.con.id}">
						<input type="hidden" name="videoid" value="{$res.id}">

						{/if}
						<div class="form-group">
							<label class="col-xs-12" for="example-text-input">标题</label>
							<div class="col-xs-12">
								<input class="form-control" type="text"
									   {if $res}value="{$res.title}"{/if}
									   id="example-text-input" name="title" placeholder="文本..">
								<div class="help-block">输入更多信息</div>
							</div>
						</div>

						<div class="form-group">
							<label class="col-xs-12" for="example-text-input">缩略图</label>
							<div class="col-xs-12">
								{if $res}{:uploader('prefimg',$res.con.prefimg)}
									{else/}
										{:uploader('prefimg')}
								{/if}
							</div>
						</div>

						<div class="form-group">
							<label class="col-xs-12" for="content">通用代码</label>
							<div class="col-xs-12">
								<textarea class="form-control" id="content" name="content" rows="6" placeholder="内容..">{if $res}{:htmlspecialchars_decode($res.content)}{/if}</textarea>
							</div>
						</div>

						<div class="form-group">
							<label class="col-xs-12" for="content">简介</label>
							<div class="col-xs-12">
								<textarea class="form-control"  name="desc" rows="20" placeholder="简介..">{if $res}{:htmlspecialchars_decode($res.con.info)}{/if}</textarea>
							</div>
						</div>

						<div class="form-group">
							<label class="col-xs-12">来源</label>
							<div class="col-xs-12">
								{foreach  $type as $v}
								<div class="radio">
									<label >
										<input type="radio" {if isset($res.type_id) && $res.type_id == $v.id}checked{/if}  name="type_id" value="{$v.id}" >
										{$v.title}
									</label>
								</div>
								{/foreach}

							</div>
						</div>


						<div class="form-group">
							<label class="col-xs-12" for="cate_id">分类</label>
							<div class="col-xs-12">
								<select class="form-control" id="cate_id" name="cate_id" size="1">
									<option value="0">请选择</option>
									{foreach $cate as $v}
									<option {if isset($res.cate_id) && $res.cate_id == $v.id}selected{/if} value="{$v.id}">{$v.name}</option>
									{/foreach}
								</select>
							</div>
						</div>

						<div class="form-group">
							<div class="col-xs-12">
								<button class="btn btn-primary" type="button" onclick="sub_youku()">提交</button>
							</div>
						</div>
					</form>

				</div>
			</div>
		</div>


	</div>

</div>



{include file="public/afooter"}
<script>
	function sub_youku() {
		var url = "{:url('save')}";
        var data = $("form").serialize();
        $.post(url,data,function (e) {
            if(e.code != 200){
                error(e.msg);
            }else {
                success(e.msg);
                var index = parent.layer.getFrameIndex(window.name);
                setTimeout(function(){parent.layer.close(index)}, 1000);
                window.parent.location.reload();
            }
        })
    }
</script>